# 继承
# 演示单继承
# class Phone:
#     IMEI = None  # 序列号
#     producer = "HM"  # 厂商
#
#     def call_by_4g(self):
#         print("4g通话")
#
#
# class Phone2022(Phone):
#     face_id = "10001" # 面部识别ID
#
#     def call_by_5g(self):
#         print("2022年新功能：5g通话")
#
#
# phone = Phone2022()
# print(phone.producer)
# phone.call_by_4g()
# phone.call_by_5g()


# 多继承
# class Phone:
#     IMEI = None  # 序列号
#     producer = "ITCAST"  # 厂商
#
#     def call_by_5g(self):
#         print("5g通话")
#
#
# class NFCReader:
#     nfc_type = "第五代"
#     producer = "HM"
#
#     def read_card(self):
#         print("NFC读卡")
#
#     def write_card(self):
#         print("NFC写卡")


# class RemoteControl:
#     rc_type = "红外遥控"
#
#     def control(self):
#         print("红外遥控开启了")
#
#
# # 继承多个父类
# class MyPhone(Phone, NFCReader, RemoteControl):
#     pass



# my_phone = MyPhone()
# my_phone.read_card()
# my_phone.write_card()
# my_phone.control()
# my_phone.call_by_4g()
# # 输出同名属性时，继承的顺序靠左，优先级越高！！！
# print(my_phone.producer)



# 继承：复写和使用父类成员
# 对父类的成员属性和成员方法，对其不满意，则可以进行复写其功能


# class MyPhone(Phone):
#     producer = "ITHEIMA"  # 复写父类的成员属性
#
#     def call_by_5g(self):
#         print("开启CPU单核模式，确保通话的时候省电！")
#         print("使用5g网络进行通话")
#         print("关闭CPU单核模式，确保性能")
#
#
# phone = MyPhone()
# phone.call_by_5g()
# print(phone.producer)


# 调用父类的同名成员
class Phone:
    IMEI = None  # 序列号
    producer = "ITCAST"  # 厂商

    def call_by_5g(self):
        print("使用5g网络进行通话")

class MyPhone(Phone):
    producer = "ITHEIMA"  # 复写父类的成员属性

    def call_by_5g(self):
        print("开启CPU单核模式，确保通话的时候省电！")
        # # 方式1：
        # print(f"父类的厂商是：{Phone.producer}")
        # Phone.call_by_5g(self)
        # 方式2：
        print(f"父类的厂商是：{super().producer}")
        super().call_by_5g()
        print("关闭CPU单核模式，确保性能")

phone = MyPhone()
phone.call_by_5g()


# 方式1：
# 父类名.成员变量
# 父类名.成员方法(self)

# 方式2
# super().成员变量
# super().成员方法()
